<template>
  <div class="app-container children">
    <el-tabs v-model="activeName" type="card" @tab-remove="removeTab" @tab-click="clickTab">
      <!-- <el-tab-pane label="盘点任务" name="1">
        <template v-if="activeName === '1'">
          <List @handleOpen="handleOpen"></List>
        </template>
      </el-tab-pane> -->
      <el-tab-pane label="库存盘点" name="2">
        <template v-if="activeName === '2'">
          <Mine @handleOpen="handleOpen" @handleInventory="handleInventory"></Mine>
        </template>
      </el-tab-pane>
      <el-tab-pane label="盘点详情" name="3" closable v-if="tabIndex">
        <template v-if="activeName === '3'">
          <CationChildren :rowObj="rowObj"></CationChildren>
        </template>
      </el-tab-pane>
      <el-tab-pane label="盘点" name="4" closable v-if="twotabIndex">
        <template v-if="activeName === '4'">
          <StartInventory :rowObj="tworowObj" @quit="quit"></StartInventory>
        </template>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
export default {
  name: "inventoryCheck",
  // dicts: ['sys_notice_status', 'sys_notice_type'],
  components: {
    // List: () => import('./list/index.vue'),//列表
    Mine: () => import('./mine/index.vue'),//我的盘点
    CationChildren: () => import('./list/form/cationChildren.vue'),//任务详情
    StartInventory: () => import('./mine/form/startInventory.vue'),//开始盘点
  },
  data () {
    return {
      activeName: '2',
      tabIndex: false,
      twotabIndex: false,
      tworowObj: undefined,
      rowObj: undefined,
      timeOut: undefined
    };
  },
  created () {
  },
  // destroyed () {//清除定时器
  //   clearTimeout(this.timeOut)
  // },
  watch: {
  },
  methods: {
    /**
     * 关闭
     */
    removeTab () {
      this.tabIndex = false
      this.twotabIndex = false
      this.activeName = '2'
    },
    /**平账完成,关闭盘点页面 */
    quit () {
      this.twotabIndex = false
      this.activeName = '2'
    },
    clickTab () {
      if (this.activeName === '2') {
        this.tabIndex = false
        this.twotabIndex = false
      }
    },
    /**
     * 打开任务列表详情
     * @param {任务列表参数} row 
     */
    handleOpen (row) {
      this.rowObj = row
      this.tabIndex = true
      this.activeName = '3'
    },
    /**
     * 开始盘点
     * @param {任务列表参数} row 
     */
    handleInventory (row) {
      this.tworowObj = row
      this.twotabIndex = true
      this.activeName = '4'
    }
  }
};
</script>
